package com.yanq.liancar.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yanq.liancar.R;
import com.yanq.liancar.bean.CouponBean;
import com.yanq.liancar.bean.DaijinQuanBean;

import java.util.List;

public class ServiceQAdapter extends BaseQuickAdapter<DaijinQuanBean.DataBean,BaseViewHolder> {
    public ServiceQAdapter(int layoutResId, @Nullable List<DaijinQuanBean.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, DaijinQuanBean.DataBean item) {
        helper.setText(R.id.tv_name,item.getCashcoupon_name())
                .setText(R.id.tv_content,item.getCashcoupon_source())
                .setText(R.id.tv_Termofvalidity,item.getIndate_start()+"-"+item.getIndate_end());
//                .setText(R.id.tv_Deductible,item.getCashcoupon_value());
        RelativeLayout relativeLayout=helper.getView(R.id.rl_bg);
        ImageView imageView=helper.getView(R.id.img_statu);

        if (item.getCashcoupon_status()==0){
            relativeLayout.setBackground(mContext.getResources().getDrawable(R.mipmap.coupon2));
            imageView.setImageResource(R.mipmap.lijishiyong);
            helper.addOnClickListener(R.id.img_statu);
        }else if (item.getCashcoupon_status()==1){
            relativeLayout.setBackground(mContext.getResources().getDrawable(R.mipmap.coupon3));
            imageView.setImageResource(R.mipmap.ysy);
        }else {
            relativeLayout.setBackground(mContext.getResources().getDrawable(R.mipmap.coupon1));
            imageView.setImageResource(R.mipmap.ygq);
        }
    }
}
